1. Field of Invention
The invention relates to an image processing technique for skewed images and, in particular, to an angle de-skew device and method thereof to rotate a skewed image by an angle in order to obtain a better output image.
2. Related Art
The digital processing system usually uses a rectangular grid of pixels to represent an image. A 24-bit digital processing system is defined in terms of the red, green, and blue colors, each of which is represented by 8 bits. That is, each color has 256 levels (from the darkest to the brightest). However, the image may be skewed or misaligned from the corresponding rectangular grid during the scanning process. In particular, during the scanning process, a physical image is converted into binary information linked to a digital computer system.
For example, suppose a scanning device obtains an image. If the paper of the original image is not correctly placed on the scanning platform, the obtained image output to the image processing system will be skewed. Therefore, the image is not desirable if it is displayed or printed. Currently, there are many methods to correct skewed images.
With reference to FIG. 1, a de-skewing method is to rotate a skewed original image 102 on the rectangular grid 100 of pixels by a skew angle θ, thereby obtaining a less skewed image 104. The conventional method makes use of sine/cosine functions in image rotations. That is, they use the sine/cosine functions to compute the rotated image coordinates. The rotation formulas are given byXr=Xo×Cosine (θ)  (1)Yr=Yo×Sine (θ)  (2)where (Xo, Yo) are the pixel coordinates of Po in the original image 102, and (Xr, Yr) are the pixel coordinates of Pr in the rotated image 104.
Here Eqs. (1) and (2) require the use of two multipliers and sine/cosine functions to achieve the rotation. However, the multipliers for coordinate transformation are big and the computation of sine/cosine functions is very time-consuming and power-consuming.
An image rotation method and a corresponding image rotation device to rotate an M×N original image by an angle θ is disclosed in the R.O.C. Pat. No. 178690. The method includes the following steps. First, set first initial values (n, m) after the unit (1, 0) on the X-axis of original image coordinate (Xo, Yo) is rotate by θ, where n=Cosine (θ), m=Sine (θ). Then set second initial values (−m, n) after the unit (0, 1) on the Y-axis of original image coordinate (Xo, Yo) is rotated by θ, where n=Cosine (θ), and m=Sine (θ). At the same time, the second initial values (−m, n) are added to the first initial values (n, m). Afterwards, the rotated image coordinates (Xr, Yr) of (1, 1) are determined using the original image coordinates (Xo, Yo) as the rotation reference point. When the value of Y is increased by 1, the second initial values (−m, n) are accumulated. The above step is repeated N−1 times. Then when the value of X is increased by 1, the first initial values (n, m) are accumulated. The above steps are repeated M−1 times.
As shown in FIG. 2, the image rotation device includes four accumulator circuits 210, 220, 230, 240. Each accumulator circuit 210, 220, 230, or 240 includes: a adder 212, 222, 232, or 242 for summing the cosine value n or the sine value m and the accumulated value, a register 214, 224, 234, or 244 for recording the added results and outputting the accumulated result to the adder 212, 222, 232, or 242 in response to a control signal S1, S2, S5, or S6, and a transmitting gate 216, 226, 236, or 246 for transmitting the added results of the adder 212, 222, 232, or 242 in response to a control signal S3, S4, S7, or S8. That is, the first accumulator circuit 210 accumulates corresponding the initial value n of the rotating angle θ of the X unit point (1, 0) when the X coordinate is increased by 1. The second accumulator circuit 220 accumulates corresponding the initial value m of the rotating angle θ of the X unit point (1, 0) when the X coordinate is increased by 1. The third accumulator circuit 230 adds the initial value −m of the rotating angle θ of the Y unit point (0, 1) to the output of the first accumulator 210. When the Y value is increased by 1, −m is added to the above-mentioned sum, thereby determining the value of Xr. The fourth accumulator 240 receives the output from the second accumulator 220 and determines the value of Yr using the same method as the third accumulator circuit 230.
In spite of the fact that this method is simpler than the previous method that totally use multipliers, this method requires the use of four accumulators, and thus has a higher cost and a more complicated operating scheme. Therefore, there is still room for finding a simpler circuit and calculation method so that the manufacturing cost can be reduced.